﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Avalonia.OpenGL;
using OpenTK;

namespace Test.UI.OpenGL3D;

/// <summary>
/// Avalonia OpenGL接口到OpenTK的桥接类
/// </summary>
public class AvaloniaGLInterface(GlInterface gl) : IBindingsContext
{
    private readonly GlInterface _gl = gl ?? throw new ArgumentNullException(nameof(gl));

    /// <summary>
    /// 获取指定函数名称的函数指针地址
    /// </summary>
    /// <param name="procName">要获取地址的函数名称</param>
    /// <returns>返回指定函数的指针地址，如果未找到则返回空指针</returns>
    public IntPtr GetProcAddress(string procName)
    {
        return _gl.GetProcAddress(procName);
    }
}